/**
 * 
 */
package org.xserver.core.util;

import java.io.File;
import java.io.IOException;

import org.apache.log4j.Logger;
import org.xserver.Messages;

/**
 * @author jkonopka
 * 
 */
public final class FileUtil {

	private static final Logger LOG = Logger.getLogger(FileUtil.class);

	/**
	 * 
	 */
	private FileUtil() {
	}

	/**
	 * @param file path to create
	 * @throws IOException Errorhandling
	 */
	public static void createFolder(final String file) throws IOException {
		createFolder(new File(file));
	}

	/**
	 * @param file path to create
	 * @throws IOException Errorhandling
	 */
	public static void createFolder(final File file) throws IOException {
		final boolean isCreate = file.mkdir();
		if (!isCreate) {
			LOG.error(Messages.getValue("error.create.directory", file.getAbsolutePath()));
			throw new IOException(Messages.getValue("error.create.directory", file.getAbsolutePath()));
		}
		LOG.info(Messages.getValue("directory.is.created", file.getAbsolutePath()));
	}

}
